package com.xht.controller;


import com.xht.annotation.SystemLog;
import com.xht.domain.ResponseResult;
import com.xht.domain.entity.User;
import com.xht.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 个人信息查看功能
     */
    @GetMapping("/userInfo")
    public ResponseResult userInfo() {

        return userService.userInfo();
    }

    /**
     * 个人信息的更新
     */
    @PutMapping("/userInfo")
    @SystemLog(businessName = "更新用户信息")
    public ResponseResult updateUserInfo(@RequestBody User user) {
        return userService.updateUserInfo(user);
    }

    /**
     * 注册
     */
    @PostMapping("/register")
    public ResponseResult register(@RequestBody User user) {

        return userService.register(user);
    }

}
